Skip to content

Add comprehensive test suite following TDD guidelines without mocks#30

Merged
benomahony merged 14 commits intomainfrom
claude/add-comprehensive-tests-Ly27X
Feb 2, 2026
Merged

Add comprehensive test suite following TDD guidelines without mocks#30
benomahony merged 14 commits intomainfrom
claude/add-comprehensive-tests-Ly27X

Conversation

@benomahony
Copy link
Copy Markdown
Owner

This commit adds a complete testing infrastructure for uv.nvim:

Test Infrastructure:

  • Makefile with test targets (test, test-standalone, test-plenary)
  • Minimal init.lua for isolated test environment
  • Custom standalone test runner requiring no external dependencies
  • Plenary.nvim compatible tests for users who prefer that framework

New Utils Module (lua/uv/utils.lua):

  • Pure functions extracted for testability
  • Code parsing: extract_imports, extract_globals, extract_functions
  • Code analysis: is_all_indented, analyze_code, extract_function_name
  • Config utilities: validate_config, merge_configs
  • Selection helpers: extract_selection, wrap_indented_code
  • Environment helpers: is_venv_path, build_run_command

Test Coverage:

  • Configuration tests (defaults, merging, custom options)
  • Code parsing tests (imports, globals, functions, expressions)
  • Selection processing tests (indented code, expressions, functions)
  • Virtual environment tests (activation, auto-activation, PATH)
  • Integration tests (setup, commands, global exposure)
  • Buffer operations tests (real Neovim buffer interactions)
  • File operations tests (temp file creation)

Run tests with: make test (standalone) or make test-plenary

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK

claude added 10 commits February 1, 2026 05:23
This commit adds a complete testing infrastructure for uv.nvim:

Test Infrastructure:
- Makefile with test targets (test, test-standalone, test-plenary)
- Minimal init.lua for isolated test environment
- Custom standalone test runner requiring no external dependencies
- Plenary.nvim compatible tests for users who prefer that framework

New Utils Module (lua/uv/utils.lua):
- Pure functions extracted for testability
- Code parsing: extract_imports, extract_globals, extract_functions
- Code analysis: is_all_indented, analyze_code, extract_function_name
- Config utilities: validate_config, merge_configs
- Selection helpers: extract_selection, wrap_indented_code
- Environment helpers: is_venv_path, build_run_command

Test Coverage:
- Configuration tests (defaults, merging, custom options)
- Code parsing tests (imports, globals, functions, expressions)
- Selection processing tests (indented code, expressions, functions)
- Virtual environment tests (activation, auto-activation, PATH)
- Integration tests (setup, commands, global exposure)
- Buffer operations tests (real Neovim buffer interactions)
- File operations tests (temp file creation)

Run tests with: make test (standalone) or make test-plenary

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- CI runs on push to main and all pull requests
- Tests on multiple Neovim versions (0.9.5, 0.10.0, stable, nightly)
- Runs standalone tests (no external dependencies required)
- Adds stylua linting step for code formatting checks
- Adds stylua.toml configuration file

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Change "mock project structure" to "test project structure" since
we're creating real directories, not using mocks.

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Update stylua.toml to use 4-space indentation and convert all
Lua files from tabs to spaces for consistency.

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
The main branch uses tabs, so reverting stylua.toml and all
Lua files to use tabs for consistency.

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Collapse long assert_true call in remove_package_spec.lua
- Expand long error() call in auto_activate_venv_spec.lua

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Removed:
- lua/uv/utils.lua (not used by plugin, only tests)
- tests/plenary/ (duplicate of standalone tests)
- tests/standalone/test_*.lua individual files (duplicated in test_all.lua)
- tests/fixtures/ (unused)
- tests/run_tests.lua (unnecessary wrapper)

Simplified:
- test_all.lua now directly tests plugin API (~280 lines)
- Makefile reduced to essentials

Result: ~2900 lines removed, focused tests remain.

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
Remove the over-engineered standalone runner in favor of a simple
self-contained test file following the existing pattern in the codebase.

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Replace custom assert helpers with Lua's built-in assert()
- Remove Makefile that didn't exist before

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
@benomahony benomahony force-pushed the claude/add-comprehensive-tests-Ly27X branch from 9e45cd6 to 4aa94a5 Compare February 1, 2026 06:01
Remove custom it() wrapper and counters. Just run assertions directly.

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Convert all test files to use plenary's describe/it/assert
- Update minimal_init.lua to clone plenary if needed
- Update CI to use PlenaryBustedDirectory

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
- Remove duplicate is_venv_active test (already in statusline_spec)
- Remove low-value "exports expected functions" test
- Remove "is exported as a function" test from remove_package
- Better organize describe blocks

https://claude.ai/code/session_01Y59Vp848pXVTZj7hKVsCRK
@benomahony benomahony merged commit abace57 into main Feb 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants